﻿using ConsumeDemo.Model;
using ConsumeDemo.Services;
using DotNetCore.CAP;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace ConsumeDemo.Controllers
{
    [Route("api/Teams")]
    [ApiController]
    public class VideoController : ControllerBase
    {
        private readonly IVideoService videoService;
        public VideoController(IVideoService videoService)
        {
            this.videoService = videoService;
        }

        /// <summary>
        /// 视频添加
        /// </summary>
        /// <param name="Video"></param>
        /// <returns></returns>
        [NonAction] //用于标识此函数不是接口，将不能被http请求访问
                    //[CapSubscribe("video.event.*")] // *  一对多匹配 # 一对一匹配
        [CapSubscribe("video.event.post")]
        public Guid PostVideo(Video Video)
        {
            Video.Id = Guid.NewGuid();
            videoService.Create(Video);

            //return CreatedAtAction("GetVideo", new { id = Video.MemberId }, Video);
            return Video.Id;
        }

    }
}
